package com.match.pattern.factory.simplefactory;
/**
 * 
 * @author match
 * 2017年10月13日14:25:58
 */
public class SimpleFactory {

	public SimpleFactory() {
	}
	
	public Object create(Class<?> clazz) {
		if(clazz.getName().equals(Grass.class.getName()))
			return createGrass();
		else if(clazz.getName().equals(Flower.class.getName()))
			return createFlower();
		else 
			return null;
	}
	
	private Grass createGrass() {
		return new Grass();
	}
	
	private Flower createFlower() {
		return new Flower();
	}
	
}
